package assignment;
import java.util.Scanner;

class Ascending
{
	int [] arr=null;
	public Ascending(int[] arr)
	{
		this.arr=arr;
	}
	public void displayArr()
	{
		System.out.println("Array in ascending order");
		for (int i=0;i<arr.length;i++)
		{
		System.out.println(arr[i]);
		}	
	}
	public void sortAscending()
	{
	for(int i=0;i<(arr.length-1);i++)
	{
		for (int j=i+1;j<arr.length;j++)
		{
			if(arr[i]>arr[j])
			{
			int x,y;
			x=arr[i];
			y=arr[j];
			arr[i] = y;
			arr[j] = x;
			} 
		}
	}
	
	}
}	
class Descending
{
	int [] arr=null;
	public Descending(int[] arr)
	{
		this.arr=arr;
	}
	public void displayArr()
	{
		System.out.println("Array in descending order");
		for (int i=0;i<arr.length;i++)
		{
		System.out.println(arr[i]);
		}	
	}
	public void sortDescending()
	{
	for(int i=0;i<(arr.length-1);i++)
	{
		for (int j=i+1;j<arr.length;j++)
		{
			if(arr[i]<arr[j])
			{
			int x,y;
			x=arr[i];
			y=arr[j];
			arr[i] = y;
			arr[j] = x;
			} 
	    }
	}
	}
	

}
public class AscDsc 
{
	public static void main(String[] args) 
	{
		Scanner n1=new Scanner (System.in);
		System.out.println("Enter the numbers");
		int arr1[]=new int[5];
		for(int i=0;i<arr1.length;i++)
		{
			arr1[i]=n1.nextInt();
		}
		Ascending asc=new Ascending(arr1);
		
		asc.sortAscending();
		
		asc.displayArr();
		
		
     Descending desc=new Descending(arr1);
		
     desc.sortDescending();
		
     desc.displayArr();
	}

}
